import 'package:flutter/material.dart';

class FileUtil {
  /// 根据路径截取文件名
  /// withOutSuffix: 不带后缀
  static String getFileName(String path, {bool withOutSuffix = false}) {
    List<String>? strs = path.split("/");
    debugPrint('文件名 --- ${strs.last}');

    if (withOutSuffix) {
      // 不带后缀
      strs = strs.last.split(".");
      return strs.first;
    }
    return strs.last;
  }
}
